home *** CD-ROM | disk | FTP | other *** search
/ Star Trek Starfleet Academy Mini Omnipedia / MINI_OMNI.ISO / pc / omni_v2.dxr / 00396_Stretch Script.ls < prev    next >
Encoding:
Text File  |  1996-04-15  |  3.1 KB  |  106 lines

  1. property iSprNum, iHomeLocH, iHomeLocV, iExpandSpeed, iBarHeight, iNumofBars, iColHeight, iFullCast, iBarWidth, iDefaultBar, iReturnList, iHLTop, iHLLeft
  2. global gFlashPixel, gHltPixel, gGlobalStepCount, gPixelHold, gExtraSpeed, gPopupSND, gTbarSND, oIndexScroller
  3.  
  4. on birth me, thespr, barHt, numofBars, widthofBar, castmem, DefaultBar, speed, pRetLst
  5.   set iSprNum to thespr
  6.   set iDefaultBar to DefaultBar
  7.   set iBarHeight to barHt + 0.0
  8.   set iNumofBars to numofBars
  9.   set iBarWidth to widthofBar
  10.   set iColHeight to iBarHeight * iNumofBars
  11.   set iFullCast to castmem
  12.   set iHomeLocH to the locH of sprite iSprNum
  13.   set iHomeLocV to the locV of sprite iSprNum
  14.   set iExpandSpeed to speed + gExtraSpeed
  15.   set iReturnList to pRetLst
  16.   sort(iReturnList)
  17.   return me
  18. end
  19.  
  20. on mUnfold me
  21.   hearit(gPopupSND)
  22.   set the castNum of sprite iSprNum to iFullCast
  23.   set the stretch of sprite iSprNum to 1
  24.   set the width of sprite iSprNum to iBarWidth
  25.   set i to iBarHeight
  26.   repeat while i < iColHeight
  27.     set the height of sprite iSprNum to i
  28.     updateStage()
  29.     set i to i + iExpandSpeed
  30.   end repeat
  31.   set the stretch of sprite iSprNum to 0
  32.   updateStage()
  33.   set the castNum of sprite iSprNum to iFullCast
  34. end
  35.  
  36. on mDumpParams me
  37. end
  38.  
  39. on mSwitchCast me, whereHor, whereVer, vwhom
  40.   puppetSprite(gHltPixel, 1)
  41.   set the locH of sprite gHltPixel to whereHor
  42.   set the locV of sprite gHltPixel to whereVer
  43.   set the castNum of sprite gHltPixel to vwhom
  44.   updateStage()
  45. end
  46.  
  47. on mRollOver me
  48.   repeat while the stillDown
  49.     if the mouseCast = iFullCast then
  50.       set vMousePos to the mouseV
  51.       set vRelativeClick to vMousePos - the top of sprite iSprNum
  52.       set vWhere to integer((vRelativeClick / iBarHeight) + 0.4999999)
  53.       if vWhere < 1 then
  54.         set vWhere to 1
  55.       end if
  56.       set whereHor to the left of sprite iSprNum
  57.       set whereVer to the top of sprite iSprNum + ((vWhere - 1) * iBarHeight)
  58.       set vwhom to iFullCast + vWhere
  59.       mSwitchCast(me, whereHor, whereVer, vwhom)
  60.       next repeat
  61.     end if
  62.     if (the mouseCast > (iFullCast + iNumofBars)) or (the mouseCast < iFullCast) then
  63.       mSwitchCast(me, whereHor, whereVer, gPixelHold)
  64.     end if
  65.   end repeat
  66.   mSwitchCast(me, whereHor, whereVer, gPixelHold)
  67.   if (the mouseCast = iFullCast) and (vwhom > 0) then
  68.     set iDefaultBar to vwhom + iNumofBars
  69.     mPlaceaBar(me, iDefaultBar)
  70.     updateStage()
  71.     mUpdateChroIndex(oIndexScroller, getAt(iReturnList, vWhere))
  72.   else
  73.     mPlaceaBar(me, iDefaultBar)
  74.   end if
  75. end
  76.  
  77. on mPlaceaBar me, whatbarnum
  78.   hearit(gTbarSND)
  79.   puppetSprite(iSprNum, 1)
  80.   set the castNum of sprite iSprNum to whatbarnum
  81.   updateStage()
  82. end
  83.  
  84. on mLeaveMode me
  85.   set the stretch of sprite iSprNum to 0
  86.   puppetSprite(iSprNum, 0)
  87.   puppetSprite(gHltPixel, 0)
  88.   updateStage()
  89. end
  90.  
  91. on mHltfromScripts me
  92.   puppetSprite(iSprNum, 1)
  93.   set Lwhereat to the iPagePointer of oIndexScroller
  94.   if Lwhereat = 1 then
  95.     set whatnum to 1
  96.   else
  97.     set whatnum to getPos(iReturnList, Lwhereat)
  98.     if whatnum = 0 then
  99.       set whatnum to findPosNear(iReturnList, Lwhereat)
  100.     end if
  101.   end if
  102.   set whatnum to iNumofBars + iFullCast + whatnum
  103.   set the castNum of sprite iSprNum to whatnum
  104.   updateStage()
  105. end
  106.